package com.github.ilioili.justdoit.components.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.github.ilioili.justdoit.BuildConfig;
import com.github.ilioili.justdoit.R;
import com.github.ilioili.justdoit.common.AppBaseActivity;
import com.taihe.template.base.injection.Id;
import com.taihe.template.base.injection.Layout;
import com.taihe.template.base.util.ToastUtil;

@Layout(R.layout.activity_about)
public class AboutActivity extends AppBaseActivity {
    @Id(R.id.tv_version_name)
    private TextView tvVersionName;

    public static Intent newIntent(MainActivity context) {
        return new Intent(context, AboutActivity.class);
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tvVersionName.setText(BuildConfig.VERSION_NAME);
    }

    public void onClickFeedback(View v) {
        String url = "mqqwpa://im/chat?chat_type=wpa&uin=136351754";
        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
        if (null != intent.resolveActivity(getPackageManager())) {
            startActivity(intent);
        } else {
            intent = new Intent(Intent.ACTION_VIEW, Uri.parse("fb://profile/100012517003083"));
            if (null == intent.resolveActivity(getPackageManager())) {
                ToastUtil.showShortToast(getString(R.string.not_social_find_error));
            } else {
                startActivity(intent);
            }
        }
    }
}
